package com.cy.ppj.dao.mapper.message;

import com.cy.ppj.model.domian.message.MessageRecord;
import com.cy.ppj.model.query.message.MessageRecordQuery;
import com.cy.ppj.model.vo.front.message.MessageIndexVO;
import com.cy.ppj.model.vo.front.message.MessageRecordVO;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

@Mapper
public interface MessageRecordMapper extends BaseMapper<MessageRecord> {

    int insertBatch(@Param("messageRecords") List<MessageRecord> messageRecords);

	int selectMessageRecordCount(MessageRecordQuery query);

	List<MessageRecordVO> selectMessageRecordList(MessageRecordQuery query);

	/**
	 * 查询个人消息的：未读数量，最近一条消息信息详情
	 * 
	 * @param userId
	 * @return
	 */
	MessageIndexVO selectMessageIndexInfo(@Param("userId") Long userId);
	
	/**
	 * 把个人消息置为已读状态
	 * 
	 * @param userId
	 * @return
	 */
	int updateToReadByUserId(@Param("userId") Long userId);
}
